package com.blb.community_admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.community_admin.entity.SysRole;
import com.blb.community_admin.mapper.RoleMapper;
import com.blb.community_admin.service.IRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, SysRole> implements IRoleService {

    @Resource
    private RoleMapper roleMapper;

    @Override
    public List<SysRole> getRolesByUserId(Long userId) {
        return roleMapper.selectRolesByUserId(userId);
    }

    @Override
    public IPage<SysRole> getByText(Page<SysRole> sysRolePage,SysRole sysRole) {
        return roleMapper.getByText(sysRolePage,sysRole);
    }

    @Override
    public void deleteRoles(Long roleId) {
        roleMapper.deleteRoles(roleId);
    }

    @Override
    public SysRole getRoleByuserId(long userId) {
        return roleMapper.selectRoleByuserId(userId);
    }

}
